//
//  LZUser.swift
//  Weibo
//
//  Created by lzing on 16/3/25.
//  Copyright © 2016年 lzing. All rights reserved.
//

import UIKit

class LZUser: NSObject {

    /// 用户UID
    var id : Int64 = 0
    
    /// 用户昵称
    var screen_name : String?
    
    //  用户头像地址
    var profile_image_url : String?
    
    /// 会员等级 1-6
    var mbrank : Int = 0 {
        didSet {
            if mbrank > 0 && mbrank <= 6 {
                mbrankView = UIImage(named: "common_icon_membership_level\(mbrank)")
            } else {
                mbrankView = nil
            }
        }
    }
    
    /// 会员图片
    var mbrankView: UIImage?

    /// 没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
    var verified_type : Int = -1 {
        didSet {
                switch verified_type {
                case 0:
                    verified_typeImage = UIImage(named: "avatar_vip")
                case 2,3,5:
                    verified_typeImage = UIImage(named: "avatar_enterprise_vip")
                case 220:
                    verified_typeImage = UIImage(named: "avatar_grassroot")
                default:
                    verified_typeImage = nil
                }
        }
    }
    
    var verified_typeImage : UIImage?
    
    ///  字典转模型
    init(dict : [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    /// 打印模型
    override var description : String {
        let keys = ["id", "screen_name", "profile_image_url", "mbrank", "verified_type"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
